
	.set MBOOT_PAGE_ALIGN , 1<<0  #  ; Load kernel and modules on a page boundary
	.set MBOOT_MEM_INFO ,1<<1    #; Provide your kernel with memory info
	.set MBOOT_HEADER_MAGIC,0x1BADB002 #; Multiboot Magic value
	#; NOTE: We do not use MBOOT_AOUT_KLUDGE. It means that GRUB does not
	#; pass us a symbol table.
	.set MBOOT_HEADER_FLAGS, (MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO)
	.set MBOOT_CHECKSUM, -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)


	.code32  #                     ; All instructions should be 32-bit.

	.global mboot     #             ; Make 'mboot' accessible from C.
	#[EXTERN code]             #      ; Start of the '.text' section.
	#[EXTERN bss]                    ; Start of the .bss section.
	#[EXTERN end]                    ; End of the last loadable section.

	mboot:
	  .long  MBOOT_HEADER_MAGIC       # ; GRUB will search for this value on each
	                                # 4-byte boundary in your kernel file
	  .long  MBOOT_HEADER_FLAGS        # How GRUB should load your file / settings
	  .long  MBOOT_CHECKSUM            #; To ensure that the above values are correct
	 
	  .long mboot                     #; Location of this descriptor
	  .long  code                      # ; Start of kernel '.text' (code) section.
	  .long bss                       #; End of kernel '.data' section.
	  .long  end                       #; End of kernel.
	  .long  start                     #; Kernel entry point (initial EIP).

	#[GLOBAL start]                  #; Kernel entry point.
	#[EXTERN main]                   #; This is the entry point of our C code
	#	.extern main
	.global start

	
	start:
	push    %ebx                   #; Load multiboot header location

	#  ; Execute the kernel:
	cli                       #  ; Disable interrupts.

	lgdt fgdt_48
#	jmp .
	movw $0x10, %ax
	mov %ax, %ds
	mov %ax, %es
	mov %ax, %fs
	mov %ax, %gs
	mov %ax, %ss
	add $0xC0000000, %esp	#;convert to linear addr
#	jmp .
	ljmpl $8,$flush
flush:
	call kmain

	#movl $0xffff,%eax
	jmp .                 #   ; Enter an infinite loop, to stop the processor
	.section .setup,"a"
fgdt:
	.quad 0
	.word 0xffff,0x0000,0x9a00,0x40cf #code
	.word 0xffff,0x0000,0x9200,0x40cf #data
fgdt_48:
	.word fgdt_48 - fgdt - 1
	.long fgdt

